
public class MyByteParser {
	private StringBuffer myBuffer;
	private MyXMLParser myXMLParser;

	public MyByteParser(MyXMLParser XMLIFIER) {
		setMyBuffer(new StringBuffer());
		setMyXMLParser(XMLIFIER);
	}

	public void setMyBuffer(StringBuffer myBuffer) {
		this.myBuffer = myBuffer;
	}
	
	public void setMyXMLParser(MyXMLParser myXMLParser) {
		this.myXMLParser = myXMLParser;
	}
	
	public void process(int arg0) {
		myBuffer.append((char) arg0);
		
		if(myBuffer.length() > 14 && myBuffer.substring(myBuffer.length()-14, myBuffer.length()).equals("</WEATHERDATA>")) {
			if (myBuffer.indexOf("<?xml") != -1)
				myXMLParser.queue(myBuffer.substring(myBuffer.indexOf("?>")+2,myBuffer.length()));
			else
				myXMLParser.queue(myBuffer.toString());

			myBuffer = new StringBuffer();
		}
	}

}
